getDeviceTime

abstract fun getDeviceTime(): Date

Gets the current system time of the device, adjusted to the device's configured time zone. This is useful for operations that need to be synchronized with the local time as perceived by the device.

Return

A Date object representing the current time on the device. This value should not be null.


abstract fun getDeviceTime(@NonNull date: Date): Date

Adjusts the supplied Date object to reflect the device's configured time zone. If the input date's timezone information is different from the device's, this method converts the point in time to an equivalent Date object in the device's timezone.

Return

A new Date object representing the same instant in time as the input date, but expressed in the device's local time zone. Returns the original date if it's already in the device's timezone or if timezone information is ambiguous. Should not return null if the input is not null.

Parameters

date

The Date object to be adjusted. Must not be null.

Throws

if the input date is null.